import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode;

class Animal{
    public String name;
    public int age;
    public Animal(String name,int age){
        this.name=name;
        this.age=age;
    }
    Animal eat(){
        System.out.println(name+"吃");
        return null;
    }

    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

class Dog extends Animal{
    public Dog(String name,int age){
        super(name,age);
    }

    public void wangwang(){
        System.out.println(name+"汪汪叫");
    }
@Override
    public Dog eat(){
    System.out.println(name+"在吃狗粮");
    return null;
}

}
class Bird extends Animal{
    public Bird(String name,int age){
        super(name,age);
    }
    public void fly(){
        System.out.println(name+"在飞");
    }


}



public class test {

    public static void main(String[] args) {
        Animal animal1=new Dog("旺财",10);
        Animal animal2=new Bird("九九",2);
      animal1.eat();
        System.out.println(animal1.toString());

    }

}
